var makeSound = function(animal){
    animal.sound()
}

var Duck = function(){}
Duck.prototype.sound = function(){
    console.log("嘎嘎嘎")
}

var Chicken = function(){}
Chicken.prototype.sound = function(){
    console.log("咯咯咯")
}

// makeSound(new Duck)
// makeSound(new Chicken)

// 封装
var myObject = (function(){
    var _name = 'save'
    return{
        getName:function(){
            return _name
        },
        setName:function(name){
            _name = name
        }
    }
})()

console.log(myObject.getName())
console.log(myObject._name)
myObject.setName("aaa")
console.log(myObject.getName())
